import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class L1207 {

    public static void main(String[] args) {
        int[] arr = {1, 2, 2, 1, 1, 3};
        boolean b = new Solution().uniqueOccurrences(arr);
        System.out.println(b);
    }

    static class Solution {
        public boolean uniqueOccurrences(int[] arr) {
            HashMap<Integer, Integer> map = new HashMap<>();
            HashSet<Integer> set = new HashSet<>();

            for (int i = 0; i < arr.length; i++) {
                map.put(arr[i], map.getOrDefault(arr[i], 0) + 1);
            }

            Set<Map.Entry<Integer, Integer>> entries = map.entrySet();
            for (Map.Entry<Integer, Integer> entry : entries) {
                boolean add = set.add(entry.getValue());
                if (!add) {
                    return false;
                }
            }
            return true;
        }
    }
}
